<template>
  <div class="son">
    <h2>我是孙组件，{{ car.name }}--{{ car.price }}</h2>
  </div>
</template>

<script>
import { inject } from "vue";

export default {
  name: 'Son',
  setup() {
    // inject 使用祖 组件传来的数据
    let car = inject('car')

    return { car }
  }
}
</script>

<style>
.son {
  background-color: orange;
  padding: 10px;
}
</style>